<template>
  <div class="login">
      <div class="header">
        <div class="container">
            <span class="inbk">
				<router-link to="/index"><img src="../../../assets/images/logo.png" alt=""></router-link>
			</span>
        </div>
      </div>

      <div class="box">
        <div class="container">
           <div class="left">
                <!-- <h3>沃客崖州湾，建设新世界</h3>
                <p>Wake Yazhou Bay, building a new world</p> -->
           </div>
           <div class="right">
              <h3>{{$t('common.login.loginTit')}}</h3>
              <div class="form">
                <div class="input-line">
                  <label><img src="../../../assets/images/public/user_bg.png" width="19" height="19" alt=""></label>
                  <input type="text" maxlength="11" name="username" :placeholder="this.$t('common.login.enterzcPhone')" v-model="user.loginName"/>
                </div>
                <div class="input-line">
                  <label><img src="../../../assets/images/public/password_bg.png" width="19" height="19" alt=""></label>
                  <input type="password" name="password" :placeholder="this.$t('common.login.enterLoginPaasord')" v-model="user.password" maxlength="16" />
                </div>
                <p class="text-right"><a href="javascript:void(0)" @click="navTo('/forget')">{{$t('common.login.forgetPassword')}}</a></p>
                <div class="btn-submit" @click="login()">
                  {{$t('common.login.login')}}
                </div>
                <p class="text-center"> {{$t('common.login.noAcconut')}} <a href="javascript:void(0)" @click="navTo('/register')">{{$t('common.login.goZc')}}</a></p>
              </div>
           </div>
        </div>
      </div>

      <div class="footer getFoot">
        <div class="container">
            <p>{{$t('common.foot.copy')}} <img src="../../../assets/images/public/icp.png" width="20" height="20" alt=""> {{$t('common.foot.copy1')}}110010000000000</p>
        </div>
      </div>
  </div>
</template>
<script>
import {showToast,getUserInfoData,showToastSuccess,ajaxAdd} from '@/utils/js.js'
import {details,login,getCurrentInfo} from '@/services/api.js'
// const log = console.log
export default {
  data() {
    return {
      user:{
        "code": "",
        "identityProperties": "",
        "loginName": "",
        "password": "",
        "phone": ""
      }
    }
  },
  mounted(){
	
  },
  computed:{
   
  },
  watch:{
   
  },
  methods:{
    Content(url){
      this.$router.push(url)
    },
    navTo(url){
      this.$router.push(url)
    },
   login(){
     if(this.user.loginName==""){
       showToast(this,this.$t('common.login.loginAccount'));
         return false;
     }
    if(this.user.password==""){
        showToast(this,this.$t('common.login.passwordTip'));
         return false;
     }
      ajaxAdd(this,login,this.user,res=>{
          showToastSuccess(this,this.$t('common.tips.loginTip'))
          this.$store.dispatch('setToken',res.data)
          getUserInfoData(this,userInfo=>{
            console.log('新的用户',userInfo)
            this.$store.dispatch('setUserInfo',userInfo);
            this.$router.push({path:'/index'})
          })
      },err=>{})
   }
  }
}
</script>
<style lang="scss">
.login{

  *{
    margin: 0;
    padding:0;
  }
  .header{
    width: 100%;
    height:82px;
    background:rgba(255,255,255,1);
    opacity:1;
  }
  .container{
    width:1200px;
    height:82px;
    margin: 0 auto;
    box-sizing: border-box;
  }
  .header>.container{
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .inbk{
    display: inline-block;
    vertical-align: middle;
  }
  .box{
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-width: 1200px;
    height:600px;
    background-image: url('../../../assets/images/public/login_bg.png');
    background-repeat: no-repeat;
    background-position: top center;
    background-size: cover;
  }
  .left{
    float: left;
    width:500px ;
    padding-top:241px;
  }
  .left h3{
    font-size:33px;
    font-family:Microsoft YaHei;
    font-weight:400;
    line-height:44px;
    color:rgba(255,255,255,1);
  }
  .left p{
    font-size:24px;
    font-family:Microsoft YaHei;
    font-weight:400;
    line-height:31px;
    color:rgba(255,255,255,1);
    opacity:1;
  }
  .right{
    margin-top:130px;
    float: right;
    width:392px;
    height:380.75px;
    background-image: url('../../../assets/images/public/form-bg.png');
    background-repeat: no-repeat;
    background-position: top center;
    background-size: cover;
    opacity:1;
    padding: 22px 50px 24px 25px;
    box-sizing: border-box;
  }
  .right h3{
    font-size:28px;
    font-family:Microsoft YaHei;
    font-weight:400;
    color:rgba(255,255,255,1);
    -webkit-text-stroke:1 rgba(0,0,0,0.00);
    text-stroke:1 rgba(0,0,0,0.00);
    opacity:1;
    width: 100%;
    text-align: center;
    line-height:50px;
  }
  .text-center{
    text-align: center;
  }
   .text-right{
    text-align: right;
  }
  .right p{
    font-size:11px;
    font-family:Microsoft YaHei;
    font-weight:400;
    line-height:50px;
    color:#999;
  }
  .right p a{
    color:rgba(255,255,255,1);
    -webkit-text-stroke:1 rgba(0,0,0,0.00);
    text-stroke:1 rgba(0,0,0,0.00);
    opacity:1;
  }
  .input-line{
    display: flex;
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width:317px;
    height:45px;
    border-radius:4px;
    border:1px solid rgba(1,174,251,1);
    margin-top: 20px;
  }
  .input-line label{
    align-self: center;
    margin: 0 5px;
  }
  .input-line input{
    width: 100%;
    height: 45px;
    align-self: center;
    background: none;
    outline: none;
    border: none;
    font-size:14px;
    font-family:Microsoft YaHei;
    font-weight:400;
    color:rgba(246,246,246,1);
    -webkit-text-stroke:1 rgba(0,0,0,0.00);
    text-stroke:1 rgba(0,0,0,0.00);
    opacity:0.59;
  }
  .right .btn-submit{
    font-size:16px;
    font-family:Microsoft YaHei;
    font-weight:400;
    color:rgba(255,255,255,1);
    text-stroke:1 rgba(0,0,0,0.00);
    -webkit-text-stroke:1 rgba(0,0,0,0.00);
    opacity:1;
    width:100%;
    text-align: center;
    height:42px;
    line-height: 42px;
    background:rgba(15,84,188,1);
    opacity:1;
    border-radius:2px;
    margin-top: 20px;
	cursor: pointer;
  }
  .footer{
    text-align: center;
    width: 100%;
    height:84px;
    line-height: 84px;
    border-top:1px dashed #000;
    margin-top: 100px;
    font-size:12px;
    background:rgba(255,255,255,1);
    opacity:1;
    font-size: 12px;
    font-family:Microsoft YaHei;
    font-weight:400;
    line-height:16px;
  }
  .footer p{
    line-height: 84px;
  }
  .footer p img{
    margin: 0px 5px;
    position: relative;
    top:5px;
  }
}

</style>